home *** CD-ROM | disk | FTP | other *** search
/ No Sense / No Sense - Issue 1 (1996-02-05)(C-Lous)(AGA)[KS3.0].adf / Articles / GeSchyber35,2 < prev    next >
Text File  |  1978-02-24  |  2KB  |  64 lines

  1. \I[Make your own Chunky 2 Planar|By Scout|Section: Graphicians & Coders Pool]
  2. \F1\M\1(Continued from last page.)
  3. \F3\2
  4.  
  5. Now, what if we grabbed 8 chunky-pixels and did a 4x4 rotation, a 2x2 rotation and finally a 1x1 rotation?
  6.  
  7. (Where a7 denotes byte 'a', bit 7 aso)
  8. a7a6a5a4a3a2a1a0
  9. b7b6b5b4b3b2b1b0
  10. c7c6c5c4c3c2c1c0
  11. d7d6d5d4d3d2d1d0
  12. e7e6e5e4e3e2e1e0
  13. f7f6f5f4f3f2f1f0
  14. g7g6g5g4g3g2g1g0
  15. h7h6h5h4h3h2h1h0
  16.  
  17. Rot 4x4
  18.  
  19. a3a2a1a0e3e2e1e0
  20. b3b2b1b0f3f2f1f0
  21. c3c2c1c0g3g2g1g0
  22. d3d2d1d0h3h2h1h0
  23. a7a6a5a4e7e6e5e4
  24. b7b6b5b4f7f6f5f4
  25. c7c6c5c4g7g6g5g4
  26. d7d6d5d4h7h6h5h4
  27.  
  28. Hmm... Notice that bits 0-3 and bits 4-7 of all bytes now have been separated!
  29.  
  30. Rot 2x2
  31.  
  32. a1a0c1c0e1e0g1g0
  33. b1b0d1d0f1f0h1h0
  34. a3a2c3c2e3e2g3g2
  35. b3b2d3d2f3f2h3h2
  36. a5a4c5c4e5e4g5g4
  37. b5b4d5d4f5f4h5h4
  38. a7a6c7c6e7e6g7g6
  39. b7b6d7d6f7f6h7h6
  40.  
  41. Now bits 0-1, bits 2-3, bits 4-5 and bits 6-7 are separated.
  42.  
  43. Rot 1x1
  44.  
  45. a0b0c0d0e0f0g0h0
  46. a1b1c1d1e1f1g1h1
  47. a2b2c2d2e2f2g2h2
  48. a3b3c3d3e3f3g3h3
  49. a4b4c4d4e4f4g4h4
  50. a5b5c5d5e5f5g5h5
  51. a6b6c6d6e6f6g6h6
  52. a7b7c7d7e7f7g7h7
  53.  
  54. We now have eight bytes of bitplane-data!
  55.  
  56. However, the process can be made a bit better. Grab 16 pixels at a time, have them stored in d0-d3 and try to do all operations longword-wise! Remember to make the routine max 256 bytes long, too. (If it doesn't fit into the cache, the routine will become dramatically slower.)
  57.  
  58. The blitter can be used as well. Blitterscreen-routines are very clever: They have the pixels in scrambled order (a look-up-table required for horizontal drawing), and they don't do the 1x1 rotation! (It is instead handled via playfield-scrolling.) The black pixels on a blitterscreen are actually sprites (5 64-bit sprites) - every 2nd pixel is wrong, so the sprites hide those!
  59.  
  60. I have some C2P routines by now (most of them are homebrew). Some enlarge the pixels before writing them to the screen (2x width). If you're interested in sharing/getting ideas or sources, contact me.
  61.  
  62. Scout/c!S          kalms@vasa.gavle.se
  63.  
  64. \C[ClipArts/pinnen.Chnk]